//
//  Location.m
//  DPGJ
//
//  Created by ZhuoLaiQiang@Gmail.com on 11-12-2.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "Location.h"
#import "CONSTS.h"

@implementation Location

@synthesize  state;
@synthesize  district;
@synthesize  city;
@synthesize  address;
@synthesize  zip;

- (void)dealloc
{
    LF_RELEASE_SAFELY(state);
    LF_RELEASE_SAFELY(district);
    LF_RELEASE_SAFELY(city);
    LF_RELEASE_SAFELY(address);
    LF_RELEASE_SAFELY(zip);
    
    [super dealloc];
}

- (id)initWithDataSourceDic:(NSDictionary *)dic_
{
    /*
     {
     address = "\U671d\U9633\U533a\U5c0f\U5173\U5317\U91cc\U75322\U53f7\U6e14\U9633\U7f6e\U4e1a\U5927\U53a6B\U5ea7601\U5ba4";
     city = "\U5317\U4eac\U5e02";
     district = "\U671d\U9633\U533a";
     state = "\U5317\U4eac";
     zip = 100012;
     };
     */
    self = [super init];
    if (self)
    {
        self.state = [dic_ objectForKey: @"state"];
        self.district = [dic_ objectForKey: @"district"];
        self.city = [dic_ objectForKey: @"city"];
        self.address = [dic_ objectForKey: @"address"];
        self.zip = [NSString stringWithFormat: @"%@", [dic_ objectForKey: @"zip"]];
    }
    
    return self;
}

- (NSString *)verfiyValue:(NSString *)value_
{
    if (!value_ || [value_ isEqualToString: @""])
    {
        value_ = WUL_LIU_DETAIL_CELL_DEFAULT_TEXT;
    }
    
    return [value_ retain];
}

- (void)setState:(NSString *)state_
{
    state = [self verfiyValue: state_];
}

- (void)setDistrict:(NSString *)district_
{
    district = [self verfiyValue: district_];
}

- (void)setCity:(NSString *)city_
{
    city = [self verfiyValue: city_];
}

- (void)setAddress:(NSString *)address_
{
    address = [self verfiyValue: address_];
}

- (void)setZip:(NSString *)zip_
{
    zip = [self verfiyValue: zip_];
}

@end
